Allow switching to recent:/// even though GIO thinks it is not a native file
authorFederico Mena Quintero <federico@gnome.org>
Fri, 23 Nov 2012 18:53:35 +0000 (12:53 -0600)
committerFederico Mena Quintero <federico@gnome.org>
Fri, 23 Nov 2012 18:53:41 +0000 (12:53 -0600)
That URI is not a native file, and so it would not show up if local_only=TRUE.
Add a special case for it so that recent:/// can always be visited.

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
gtk/gtkfilechooserdefault.c

index be7a958982c02d24487abfb1cf11f4912b4f5491..85111de0f185c5f1cde316e5a86d8539cc0ff110 100644 (file)
@@ -7544,6 +7544,19 @@ out:
   g_object_unref (cancellable);
 }
 
+static gboolean
+file_is_recent_uri (GFile *file)
+{
+  GFile *recent;
+  gboolean same;
+
+  recent = g_file_new_for_uri ("recent:///");
+  same = g_file_equal (file, recent);
+  g_object_unref (recent);
+
+  return same;
+}
+
 static gboolean
 gtk_file_chooser_default_update_current_folder (GtkFileChooser    *chooser,
                                                GFile             *file,
@@ -7560,7 +7573,8 @@ gtk_file_chooser_default_update_current_folder (GtkFileChooser    *chooser,
 
   operation_mode_set (impl, OPERATION_MODE_BROWSE);
 
-  if (impl->local_only && !g_file_is_native (file))
+  if (impl->local_only && !g_file_is_native (file)
+      && !file_is_recent_uri (file)) /* GIO considers "recent:///" to be non-native; we special-case it so recent files *will* show up */
     {
       g_set_error_literal (error,
                            GTK_FILE_CHOOSER_ERROR,